var express = require('express');
var router = express.Router();
var complainModel = require('../../models/complain/complain_list');

//定义路由，当访问该路由的时候，去数据库查找信息并返回
router.post('/', function (req, res, next) {
    var params = req.body
    console.log(params)
    complainModel.create({
        order_id: params.order_id,
        openid: params.openid,
        text: params.text,
        type: params.type,
        state: 0
    }, function (err, docs) {
        if (!err) {
            res.json({ data: null, msg: '添加成功！', code: 200 })
        }
    })
})

module.exports = router;
